using System.Collections.Generic;
using System.Linq;
using Azure.Domain.Models;
using Azure.Domain.Services;
using Azure.Infrastructure;

using Rhino.Mocks;

namespace Azure.Tests.Domain.ServiceFacts
{
    public abstract class ServiceFactBase : Facts<BlogService>
    {
        protected readonly IQueryable<Post> Query;

        protected ServiceFactBase()
        {
            Query = (new List<Post> {Test.Post}).AsQueryable();
            Repository.Stub(x => x.Table).Return(Query);

            Cache.Stub(x => x.Latest).PropertyBehavior();
        }

        protected IRepository<Post> Repository
        {
            get { return Mock<IRepository<Post>>(); }
        }

        protected ICache<Post> Cache
        {
            get { return Mock<ICache<Post>>(); }
        }
    }
}